<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="text/javascript" src="__JS__/jquery.js"></script>
<title>开始考试</title>
</head>
<body>
<?php $count=0;
      $total = count($question_list);
 ?>
<form id="form" action="{:url('plus_exam/index/submit')}" method="post">
    <input type="hidden" name="school_id" value="{$school_info['id']}"/>
    {volist name="question_list" key="key" id="rs" }
    <?php
        $count++;
        
    ?>
    <div class="item" id="item_{$count}">
       <div class="title">{$key}、{$rs.content}</div>
       <div class="content">
           {if $rs['type']==1}
                {volist name="rs['options']" id="vo"}
                    <ul>
                        <li>
                            <input type="radio" name="answer[{$rs.id}]" value="{$key}">
                     
                                {$key}:{$vo}
                        </li>
                    </ul>
                {/volist}
           {elseif $rs['type']==2}
                {volist name="rs['options']" id="vo"}
                    <ul>
                        <li>
                            <input type="checkbox" name="answer[{$rs.id}][{$key}]" value="{$key}">{$key}:{$vo}
                        </li>
                    </ul>
                {/volist}
           {elseif $rs['type']==3}
                {volist name="rs['options']" id="vo"}
                    <ul>
                        <li>
                            <input type="radio" name="answer[{$rs.id}]" value="{$key}">{$key}:{$vo}
                        </li>
                    </ul>
                {/volist}
           {/if}
       </div>

    </div>
    {/volist}
    
    <div class="fn-l">
        <a class="uppt" href="javascript:void(0)">上一题</a>
        <a class="downpt" href="javascript:void(0)">下一题</a>
    </div>
    <div class="fn-r">
        <button type="submit" class="butSubmit">我要交卷</button>
    </div>
    
</form>
<div class="bottom_times">
            剩余交卷时间：
            <span id="1" class="times" minute="{$school_info['lock_time']}">
                <span class="time red" id="hour_show_1"> 0 时</span>
                <span class="time red" id="minute_show_1">0 分</span>
                <span class="time red" id="second_show_1">0 秒</span> 
            </span>
            <span class='fn-f12 fn-fn blue'>时间有30秒左右的误差!请注意自己的答题速度.</span>
        </div>
<script type="text/javascript">
$(".item").css("display","none");
var a = 1;
$("#item_"+ a).css("display","block");
$(".downpt").click(function(){
    $("#item_"+ a).css("display","none");
    a++;
    $("#item_"+a).css("display","block");
   var b = a;
   if(b>{$total}){
    alert('已经是最后一题');
    a--;
    $("#item_"+a).css("display","block");
   }
});
$(".uppt").click(function(){
    a--;
     $(".item").css("display","none");
    $("#item_"+a).css("display","block");
    if (a<1){
        alert('已经是第一道题');
        a++;
         $("#item_"+a).css("display","block");
    }

});

$(".times").each(function() {
        var a = $(this).attr("minute");
        var b = $(this).attr("id");
        timer(a, b)
    });
function timer(a, b) {
    window.setInterval(function() {
        var d = 0,
        c = 0,
        f = 0,
        e = 0;
        if (a > 0) {
            d = Math.floor(a / (60 * 60 * 24));
            c = Math.floor(a / (60 * 60)) - (d * 24);
            f = Math.floor(a / 60) - (d * 24 * 60) - (c * 60);
            e = Math.floor(a) - (d * 24 * 60 * 60) - (c * 60 * 60) - (f * 60);
        } else {
            $("#form").submit();
        }
        if (f <= 9) {
            f = "0" + f
        }
        if (e <= 9) {
            e = "0" + e
        }
        $("#hour_show_" + b).html('<s id="h"></s>' + c + " 时");
        $("#minute_show_" + b).html("<s></s>" + f + " 分");
        $("#second_show_" + b).html("<s></s>" + e + " 秒");
        a--
    },
    1000)
};
</script>
</body>
</html>